package cn.edu.dgut.sai.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.MultiValueMap;

/**
 * 判断@Bean注解方法，有没有同时含有@Sai注解，有的话，就可以实例化为Bean
 *
 * @author Sai
 * Created by Sai on 2019/9/6.
 */
public class ConditionSai implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

        if (metadata.isAnnotated(Sai.class.getName()))
            return true;

        return false;
    }
}
